package com.elite.service;

import com.elite.dao.AdressMapper;
import com.elite.entity.Adress;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by hbl on 2017/1/23.
 */
@Service("AdressService")
public class AdressServiceImpl implements AdressService {
    @Autowired
    private AdressMapper adressMapper;

    /**
     * 往地址管理表中添加一条数据
     * @param adress
     */
    @Override
    public void addAddress(Adress adress) {
        adressMapper.insert(adress);
    }

    @Override
    public List selectAddressById(Integer userId) {
        return adressMapper.selectByUserId(userId);
    }

    @Override
    public void delete(Integer addressId) {
        adressMapper.deleteByPrimaryKey(addressId);
    }

    @Override
    public void updateByAddressId(Adress adress) {
        adressMapper.updateByPrimaryKey(adress);
    }

    @Override
    public Adress selectByPrimaryKey(Integer addressId) {
        return adressMapper.selectByPrimaryKey(addressId);
    }
}
